//
//  FFWalletWithdrawAccountCell.m
//  LLWallet
//
//  Created by tt on 2020/9/9.
//

#import "FFWalletWithdrawAccountCell.h"

@implementation FFWalletWithdrawAccountModel

- (Class)cell {
    return FFWalletWithdrawAccountCell.class;
}

@end

@interface FFWalletWithdrawAccountCell ()

@property(nonatomic,strong) UIImageView *iconImgView;
@property(nonatomic,strong) UILabel *titleLbl;
@property(nonatomic,strong) UILabel *descLbl;


@end

@implementation FFWalletWithdrawAccountCell

+ (CGSize)sizeForModel:(WKFormItemModel *)model {
    return CGSizeMake(WKScreenWidth, 80.0f);
}

- (void)setupUI {
    [super setupUI];
    [self.contentView addSubview:self.iconImgView];
    [self.contentView addSubview:self.titleLbl];
    [self.contentView addSubview:self.descLbl];
}

- (UIImageView *)iconImgView {
    if(!_iconImgView) {
        _iconImgView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 45.0f, 45.0f)];
    }
    return _iconImgView;
}

- (UILabel *)titleLbl {
    if(!_titleLbl) {
        _titleLbl = [[UILabel alloc] init];
        [_titleLbl setFont:[[WKApp shared].config appFontOfSize:16.0f]];
        [_titleLbl setTextColor:[WKApp shared].config.defaultTextColor];
    }
    return _titleLbl;
}

- (UILabel *)descLbl {
    if(!_descLbl) {
        _descLbl = [[UILabel alloc] init];
        [_descLbl setFont:[[WKApp shared].config appFontOfSize:14.0f]];
        [_descLbl setTextColor:[WKApp shared].config.tipColor];
    }
    return _descLbl;
}

- (void)refresh:(FFWalletWithdrawAccountModel *)model {
    [super refresh:model];
    self.titleLbl.text = model.title;
    self.descLbl.text = model.desc;
    [self.iconImgView setImage:model.icon];
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    self.iconImgView.lim_left = 15.0f;
    self.iconImgView.lim_top = self.lim_height/2.0f - self.iconImgView.lim_height/2.0f;
    
    [self.titleLbl sizeToFit];
    self.titleLbl.lim_left = self.iconImgView.lim_right + 10.0f;
    self.titleLbl.lim_top = self.lim_height/2.0f - self.titleLbl.lim_height/2.0f;
    
    [self.descLbl sizeToFit];
    self.descLbl.lim_left = self.lim_width - self.descLbl.lim_width - 33.0f;
    self.descLbl.lim_top = self.lim_height/2.0f - self.descLbl.lim_height/2.0f;
}


@end
